<?php include_once "config/config.php"; session_start(); if (isset($_REQUEST['_SESSION'])) die("Get lost Muppet!"); ?>

<div class="content padr">
    <h2>Rezultatas</h2>
    <?php
        $result = $_SESSION['stogas'];
        $command = $_SESSION['metras'];
        $title = $_SESSION['langas'];
        $success = $_SESSION['laimas'];
        echo('<p><b>'.$result.'</p></b><br />');

        
//        echo($title);
        if ($success) {
            echo('<table border="1" class="text" cellpadding="0" cellspacing="0">');
            echo('<tr><td><span class="head" style="padding:0 5px;">Raktas</span></td><td><span class="head" style="padding:0 5px;">Laukas</span></td><td><span class="head" style="padding:0 5px;">Tipas</span>');
            echo('</td><td><span class="head" style="padding:0 5px;">Ar gali būti tuščias?</span></td><td><span class="head" style="padding:0 5px;">Nutylėta reikšmė</span><td><span class="head" style="padding:0 5px;">Kita</span></td></td></tr><tr>');
    
    
            $r = mysql_query("SHOW COLUMNS FROM $title");
            while ($row = mysql_fetch_assoc($r)) {
                //print_r($row['Field']);
                if($row['Key'] != ''){echo('<td>'.$row['Key'].'</td>');}
                else{echo('<td>-</td>');}
                echo('<td>'.$row['Field'].'</td><td>'.$row['Type'].'</td><td>'.$row['Null'].'</td>');
                if($row['Default'] != ''){echo('<td>'.$row['Default'].'</td>');}
                else{echo('<td>-</td>');}
                if($row['Extra'] != ''){echo('<td>'.$row['Extra'].'</td>');}
                else{echo('<td>-</td>');}
                echo('</tr>');

            }        
            echo('</table>');
        }
        
       
        echo('<p>Įvesta komanda:</p><br />');
         if ($success)
            echo('<pre class="code"><br/>');
        else
            echo('<pre class="codeERR"><br/>');
        echo('<code>');
        echo($command);
    ?>
    </code>
    </pre>
    <br />
    <p>Bandykite dar kartą</p><br />
    <form class="forma" action="insertQuery.php" method="post">
        <table>
            <tr><td><textarea cols="50" rows="10" name="cr_tbl"></textarea></td></tr>
            <tr><td style="text-align:right;"><input type="submit" value="Sukurti" /></td></tr>
        </table>
    </form>    
</div>